Skip to content

fix(check-gitignore): keep curated shared memory tracked - #24

Merged
sandstream merged 2 commits into
mainfrom
fix/memory-gitignore-shared
Jun 22, 2026
Merged

sandstream merged 2 commits into
mainfrom
fix/memory-gitignore-shared

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Problem

kit's memory has two tiers:

  • private brain — ~/.kit/memory.db (global, secret-dense, 0600, never committed)
  • curated/shared tier — .kit/shared/memory.jsonl, committed by design ("travels with the repo", diffable, PR-reviewable, gitleaks-scannable; deny-by-default + fail-closed secret-scan on write)

But check-gitignore's REQUIRED_PATTERNS ignored kit's local state with the wholesale .kit/ form. git won't descend into a wholesale-excluded directory, so no later !.kit/shared/ negation can re-include the curated tier. Result: running kit check → patch/heal would silently stop tracking shared memory — you'd lose the curated tier, and gitleaks/PR review would no longer see it.

Verified empirically:

.gitignore .kit/elevation.json .kit/shared/memory.jsonl
.kit/ + !.kit/shared/ ignored ✅ ignored ❌ (lost)
.kit/* + !.kit/shared/ ignored ✅ tracked ✅

Fix

Switch the local-state ignore to the descendable .kit/* form plus an explicit !.kit/shared/ re-include. Existing .kit / .kit/ lines are still recognized as aliases to avoid churn on repos that already have them.

  • src/check-gitignore.ts — .kit/ → .kit/* + new !.kit/shared/ entry (with rationale comment).
  • src/check-gitignore.test.ts — asserts patch emits .kit/* (never wholesale .kit/), emits !.kit/shared/, and that the negation comes after .kit/*.

All 12 check-gitignore tests pass.

Known residual (out of scope)

A repo that already has a wholesale .kit/ line above the kit block stays broken — appending can't fix it, the line must be rewritten (patch only appends, never rewrites user lines). Candidate follow-up: have verify() flag a pre-existing wholesale .kit/ and recommend upgrading to .kit/*.

🤖 Generated with Claude Code

https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg


Generated by Claude Code

The .kit/ REQUIRED pattern ignored kit's local state wholesale. But the
curated, committed-by-design shared tier lives at .kit/shared/memory.jsonl,
and git won't descend into a wholesale-excluded directory — so no later
negation could re-include it. Running `kit check` -> patch/heal would
silently stop tracking shared memory (and hide it from gitleaks/PR review).

Switch to the descendable `.kit/*` contents-ignore plus an explicit
`!.kit/shared/` re-include (verified: wholesale `.kit/` makes the negation
a no-op; `.kit/*` keeps it working). Existing `.kit`/`.kit/` lines are still
recognized to avoid churn.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

…ired pattern

The check-gitignore change in this PR added a second required entry
(!.kit/shared/, to keep curated shared memory tracked), but the
'every signal on' status fixture still listed only the old '.kit/'.
The gitignore signal then reported the negation as missing → ok=false →
the all-green assertion failed. Fixture now mirrors the new required
patterns (.kit/* + !.kit/shared/).
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 4cbbb11 into main Jun 22, 2026
15 checks passed
@sandstream
sandstream deleted the fix/memory-gitignore-shared branch June 22, 2026 07:57
@sandstream sandstream mentioned this pull request Jun 22, 2026
sandstream added a commit that referenced this pull request Jun 22, 2026
Cut 1.13.0 from the 11 PRs merged since v1.12.0. Backfilled the CHANGELOG
entries that landed without one (full-disk-encryption check #26, secrets
validate + env diff #28, .gitignore shared-memory fix #24, ~30k-line
dead-code flush #27/#30) and dated the section. Minor bump: all additive
or dead-code removal, nothing breaking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants